<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>

    Function.prototype.myCall = function (that,...params) {
        // 如果传入的是 undefined 或者 null则 指向window
        const _this = (that === undefined || that === null) ? window : Object(that)
        const s = Symbol('fn')
        _this[s] = this;
        const data =  _this[s](...params)
        delete _this[s]
        return data;
    }

    function f(a, b) {
        console.log(this)
        return a + b;
    }

    console.log(f.myCall({a:1}, 1, 2));


</script>
</body>
</html>